﻿using System;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Threading;
using Newtonsoft.Json;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Sustainalytics.Governance.Service.Controllers;
using Sustainalytics.Governance.Reporting;
using System.Collections.Generic;

namespace Sustainalytics.Governance.Service.Tests
{
    [TestClass]
    public class CompanyReportControllerTests
    {
        [TestMethod]
        public void Report_Generation_Test()
        {
            const int bulkSize = 100;

            var connectionStrings = new Dictionary<string, string>
            {
                {"GovernanceDW", "mongodb://localhost:27017/GovernanceDW_A"},
                {"GovernanceCompanyReportPDF", "mongodb://localhost:27017/GovernanceCompanyReportPDF_A"}
            };

            var httpRequestMessage = new HttpRequestMessage();
            httpRequestMessage.SetConfiguration(new HttpConfiguration());


            var reportsManager = ReportsManager.GetInstance(bulkSize, connectionStrings);
            reportsManager.ReportsSavePath = @"E:\Reports\";

            var companyReportController = new CompanyReportController(reportsManager)
            {
                Request = httpRequestMessage
            };

            var httpResponseMessage = companyReportController.Post(string.Empty);

            Assert.IsTrue(httpResponseMessage.StatusCode == HttpStatusCode.OK, "HttpStatusCode is not the expected one.");
        }
    }
}
